package com.hehua.InterpreterPattern;

/**
 * 简单句结点类,充当非终结符表达式角色
 */
public class SentenceNode extends AbstractNode{
    /**
     * 方向
     */
    private AbstractNode direction;
    /**
     * 方式
     */
    private AbstractNode action;
    /**
     * 距离
     */
    private AbstractNode distance;

    public SentenceNode(AbstractNode direction, AbstractNode action, AbstractNode distance) {
        this.direction = direction;
        this.action = action;
        this.distance = distance;
    }

    @Override
    public String interpret() {
        return direction.interpret()+action.interpret()+distance.interpret();
    }
}
